import random

number1 = random.randint(1, 6)
number2 = random.randint(1, 6)
number3 = random.randint(1, 6)
num = number1 + number2 + number3

print("目前现有金币为1000")
gold = 1000
win = 0
j = 0

for i in range(10000):

     while gold > 100:
          sc = input("please input litter or large")
          if sc == "large":
              if 3<= num <=10:
                gold = gold - 100
                j = j + 1
                print(f"现在剩余{gold}")
              else :
                gold = gold +100
                win= win+1
                j = j + 1
                print(f"现在剩余{gold}")
          elif sc == "litter":
              if 11 <= num <= 18:
                gold = gold - 100
                j = j + 1
                print(f"现在剩余{gold}")
              else :
                gold = gold + 100
                win = win + 1
                j = j + 1
                print(f"现在剩余{gold}")
          else:
              print("输入错误判断")
              continue  #未输入large或者litter,再次进入while

          sc1 = input("是否要继续,退出输入exit,继续请按任意键并回车")
          if sc1 == "exit":
                break   #跳出while循环
          else:
                print("请继续")


     #while循环结束，进入玩家数据统计
     if win>0:
         loss = i+1 - win
         win_rate = win/j
         print(f"胜率为{win_rate}")
     else:
         print("一把没赢")

     if gold>=1500:
         print("恭喜获得奖品")
     break#跳出for，游戏结束
